import request from '@/utils/request.js'

// const token = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjE0MjMzMzA5LCJleHAiOjE2MTQyNDA1MDl9.zTSNVbtlyPwM5T48EPgshi9M8BhLqxfGR12gW0pckys'

// 店铺数据
export function getShop() {
  return request({
    method: 'get',
    url: `/shoplist`
  })
}

// 商品所有列表
export function getLookGoodsList(params) {
  return request({
    method: 'get',
    url: `/goodsList`,
    params
  })
}

// 商品列表
export function getGoodsList(goodsList) {
  return request({
    method: 'get',
    url: `/goodsList?goodsName=${goodsList}`
  })
}

// 删除订单
export function deleteOrderList(id) {
  return request({
    method: 'DELETE',
    url: `/shoporder/${id}`

  })
}

// 编辑订单
export function editOrder(data) {
  return request({
    method: 'patch',
    url: `/shoporder/${data.id}`,
    data
  })
}

export function gitEditOrederId(id) {
  return request({
    method: 'GET',
    url: `/shoporder/${id}`
  })
}

// 获取用户列表
export function gitUserList() {
  return request({
    method: 'get',
    url: 'userName'
  })
}

// 获取订单列表
export function getOrderList(page) {
  return request({
    method: 'GET',
    url: `/shoporder?_page=${page.pager}&_limit=${page.pageSize}`
    // headers: {
    //   Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjE0MjMzMzA5LCJleHAiOjE2MTQyNDA1MDl9.zTSNVbtlyPwM5T48EPgshi9M8BhLqxfGR12gW0pckys'
    // }
  })
}

// 订单状态筛选
export function getStateList(page, state) {
  return request({
    method: 'GET',
    url: `/shoporder?status=${state}&_page=${page.pager}&_limit=${page.pageSize}`
    // headers: {
    //   Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjE0MjMzMzA5LCJleHAiOjE2MTQyNDA1MDl9.zTSNVbtlyPwM5T48EPgshi9M8BhLqxfGR12gW0pckys'
    // }
  })
}

